-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Use -noBuild
in second build steps of test jobs
#39998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b8f2192
to
c8780f0
Compare
-noBuild
in second build steps of test jobs
c182bc9
to
7c1f389
Compare
Reasoning from a sample set of one, I'd say this PR speeds up PR validation significantly. Build #20220207.20 took only 1:20 while rolling builds of 'main' almost-always take 1:40 or more. Will rerun to see if this was a fluke since all that should have been removed was up-to-date checks. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/fyi @mmitche (Mr. Build Perf 😺) |
@@ -52,7 +52,8 @@ $env:BUILD_REPOSITORY_NAME="aspnetcore" | |||
$env:SYSTEM_TEAMPROJECT="aspnetcore" | |||
|
|||
Write-Host -ForegroundColor Yellow "If running tests that need the shared Fx, run './build -pack -all' before this." | |||
Write-Host -ForegroundColor Yellow "And if packing for a different platform, add '/p:CrossgenOutput=false'." | |||
Write-Host -ForegroundColor Yellow "If everything is up-to-date, add '/p:NoBuild=true' to this command." | |||
Write-Host -ForegroundColor Yellow "Or, if only the test project is out-of-date, add '/p:BuildProjectReferences=false'." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BrennanConroy these possibilities should speed up use of this script even more than setting $(p:DoNotRequireSharedFxHelix)
😸
@@ -19,7 +19,8 @@ | |||
<ProjectReference Include="..\..\shared\Mvc.Core.TestCommon\Microsoft.AspNetCore.Mvc.Core.TestCommon.csproj" /> | |||
<ProjectReference Include="..\WebSites\*\*.csproj" | |||
Exclude="..\WebSites\ControllersFromServicesClassLibrary\ControllersFromServicesClassLibrary.csproj; | |||
..\WebSites\RazorBuildWebSite.*\RazorBuildWebSite.*.csproj" /> | |||
..\WebSites\RazorBuildWebSite.*\RazorBuildWebSite.*.csproj; | |||
..\WebSites\RazorPagesClassLibrary\RazorPagesClassLibrary.csproj" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit I noticed while in the neighbourhood
<Project> | ||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.targets))\Directory.Build.targets" /> | ||
|
||
<!-- Work around https://github.com/dotnet/sdk/issues/23777. Reset ContentWithTargetPath items if not building. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugly bug I noticed while working on this PR and this workaround likely doesn't cover all the real-world cases. /cc @marcpopMSFT @dsplaisted
<ItemGroup> | ||
<Content Include="..\Common.FunctionalTests\Infrastructure\*.config" CopyToOutputDirectory="PreserveNewest" /> | ||
</ItemGroup> | ||
|
||
<Target Name="BuildAssets" AfterTargets="Build" Condition="'$(ExcludeFromBuild)' != 'true'"> | ||
<MSBuild Projects="@(ProjectReference)" Targets="PublishTestsAssets" SkipNonexistentTargets="true" BuildInParallel="True"> | ||
<Target Name="CopyAssets" BeforeTargets="Publish" Condition=" '$(ExcludeFromBuild)' != true "> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doing the two parts in separate targets worked when Publish
always depended on Build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any noticeable change here in behavior that we need to be aware of or is this just implementation details?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing I could detect because the published files from the test assets aren't used in local tests.
@@ -59,4 +63,13 @@ | |||
</PackageReference> | |||
<Reference Include="xunit.assert" /> | |||
</ItemGroup> | |||
|
|||
<!-- Repeat Build target for win-x64 to allow later Publish w/ NoBuild=true. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just confirming that this already covers the Win32/arm64 cases as well, or if I'll need to revisit this section for arm64 later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add an arm64 profile to the @(TestAssetPublishProfile)
item group, will need another target here too. Not sure how much the Condition
will need to change w/o seeing what profile(s) you need to test. Of course, tests might have enough coverage w/o doing the self-contained thing for each possible Windows platform.
Speed-up much less noticeable in build #20220207.25. That ran for 1:44 which at least is below the 2w average for these builds. |
- building again in Publish target adds nothing in most cases - use `-noBuildRepoTasks` more consistently - again, building the repo tasks wastefully repeated work done in previous build step - use `-noBuildJava` more consistently in quarantined pipelines - Java tests aren't worth testing _or building_ in these pipelines because they cannot be quarantined - remove `-noRestore` and `-noBuildDeps` when `-noBuild` specified; redundant - work around https://github.com/dotnet/sdk/issues/23777 - do not publish .cshtml files of most test asset projects when `$(NoBuild)` is set - update FunctionalTestWithAssets.targets to help Publish succeed when `$(NoBuild)` is set - fixes build jobs in quarantined-pr pipeline where `--no-build` was already specified - for IIS test assets, perform all builds needed for their profiles within Build target - move `ReferenceTestTasks=false` and comments about it to where property matters - merge separate targets in FunctionalTest.props to make items available during (now separate) Publish nits: - touch up RunHelix.ps1 console output - reorder command line arguments for consistency in changed parts of the YAML files - move `NoBuild=true` setting out of FunctionalTestWithAssets.props - use `BeforeTargets` in FunctionalTest.props to improve determinism
7c1f389
to
898347f
Compare
/fyi all, last validation build #20220207.35 took 1:29 overall (including waiting 6 minutes to get the Helix job a build agent). Seems there's some speed-up here but, like the old world, the builds don't all take the same amount of time. |
-noBuildRepoTasks
more consistently-noBuildJava
more consistently in quarantined pipelines-noRestore
and-noBuildDeps
when-noBuild
specified; redundantdotnet publish --no-build
over-publishes from referenced projects #43835$(NoBuild)
is set$(NoBuild)
is set--no-build
was already specifiedReferenceTestTasks=false
and comments about it to where property mattersnits:
NoBuild=true
setting out of FunctionalTestWithAssets.propsBeforeTargets
in FunctionalTest.props to improve determinism